package com.xiaoshi.forms.controller;


import com.xiaoshi.forms.dto.SysFormsDto;
import com.xiaoshi.forms.entity.SysForms;
import com.xiaoshi.forms.service.ISysFormsService;
import com.xiaoshi.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 * 系统表单
 前端控制器
 * </p>
 *
 * @author yuankai
 * @since 2022-03-17
 */
@RestController
@RequestMapping("/forms/sys-forms")
public class SysFormsController {

    @Autowired
    private ISysFormsService sysFormsService;

    @PostMapping("/saveForms")
    public JsonResult saveForms(@RequestBody SysFormsDto dto){
        if(sysFormsService.saveForms(dto)){
            return JsonResult.success();
        }
        return JsonResult.fail();
    }

    @GetMapping("/getDetailById")
    public JsonResult getDetailById(Long id){
        return JsonResult.success(sysFormsService.getDetailById(id));
    }
}
